#include <iostream>
#include <stdio.h>

using namespace std;
// 判断润年
bool IsLeapYear(int year) {
    if(year%4 == 0 && year%100 != 0 || year % 400 == 0)
        return true;
    return false;
}

// 计算year年过了多少天
int DaysOfYear(int y, int m, int d){
    int mons[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int days = 0;
    if(IsLeapYear(y) && m > 2) // 是闰二月
        mons[2] += 1;
    for(int i = 0;i < m; ++i)
        days += mons[i];

    return days+d;
}

// 计算是星期几
int DaysOfWeek(int y, int m, int d){
    // y年，m月，n日距离基数（1年0月0日）过了多少天
    int days = 365*(y-1) + (y-1)/4 + (y-1)/400 - (y-1)/100 + DaysOfYear(y, m, d);
    int weekday = (days%7 == 0) ? 7 : days%7;
    return weekday;
}
// 求m月的第num个星期week多少
int DayOfFestival(int mfd, int num, int week){
    // m月1号是星期mfd
    return 1 + (num-1)*7 + (week-mfd+7)%7;
}

int death(int juneFw){  // 6月1号是星期juneFw
    return 32 - ((juneFw==1) ? 7 : (juneFw-1));
}

int main()
{
    int year;
    while(std::cin >> year){
        printf("%04d-01-01\n", year); // 元旦
        printf("%04d-%02d-%02d\n", year, 1, DayOfFestival(DaysOfWeek(year, 1, 1), 3, 1));
        printf("%04d-%02d-%02d\n", year, 2, DayOfFestival(DaysOfWeek(year, 2, 1), 3, 1));
        printf("%04d-%02d-%02d\n", year, 5, death(DaysOfWeek(year, 6, 1)) );
        printf("%04d-07-04\n", year); // 国庆
        printf("%04d-%02d-%02d\n", year, 9, DayOfFestival(DaysOfWeek(year, 9, 1), 1, 1));
        printf("%04d-%02d-%02d\n", year, 11, DayOfFestival(DaysOfWeek(year, 11, 1), 4, 4));
        printf("%04d-12-25\n\n", year); // 圣诞
    }
    return 0;
}